package com.gzxxgl.util;

import java.io.IOException;


public class BASE64encry {
	public static byte[] decode(String str){
		byte[] bt = null;
		try {
		sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
		bt = decoder.decodeBuffer( str );
		} catch (IOException e) { 
		e.printStackTrace();
		}
		return bt;
	}
	public static String encode(byte[] bstr){
		return new sun.misc.BASE64Encoder().encode(bstr);
	}
	public static String encry(String str){
		return encode(str.getBytes());
	}
	public static String decry(String str){
		return new String(decode(str));
	}	
	public static void main(String[] args) {
		System.out.println(decry("MA=="));
		System.out.println(encry("1"));
		if(args.length>1){
		System.out.println(args[0]+"==="+decry(args[0]));
		System.out.println(args[1]+"==="+encry(args[1]));
		}
	} 
}
